<?php

use App\Models\OpenShop\Common\OpenShopOrderManagerModel;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateOpenShopOrderManager extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('open_shop_order_manager', function (Blueprint $table) {
            $table->id();

            $table->bigInteger("mainProcessId")->default(0)->comment("主流程id");
            $table->unsignedInteger("managerUid")->default(0)->comment("uid");
            $table->string("managerName")->default("")->comment("经理名称");
            $table->unsignedTinyInteger("type")->default(0)->comment(enumToMigrationComment(OpenShopOrderManagerModel::TYPE_MAP, "经理类型"));
            $table->string("description", 120)->default("")->comment("经理描述");
            $table->unsignedInteger("orderStatus")->default(1)->comment(enumToMigrationComment(OpenShopOrderManagerModel::ORDER_STATUS_MAP, "订单状态"));
            $table->unsignedInteger("isDeleted")->default(0)->comment("是否已删除");


            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->collation = 'utf8mb4_general_ci';

            $table->index(['mainProcessId'], 'idx_mainProcessId');
            $table->comment = '开店流程负责人汇总表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('open_shop_order_manager');
    }
}
